package lanQiao2;

import java.util.*;

public class PartNum
{
	public static void main(String[] args)
	{
		Scanner s = new Scanner(System.in);
		
		int[] c=new int[s.nextInt()];
		for(int i=0; i<c.length; i++)
		{
			c[i]=s.nextInt();
		}
		
		for(int i=s.nextInt(); i>0; i--)
		{
			int ib=s.nextInt()-1;
			int ie=s.nextInt()-1;
			int cc=s.nextInt()-1;
			System.out.println(f(c,ib,ie,cc+ib));
		}
	}
	
	static int f(int[] c, int i, int e, int d)
	{
		int ib=i;
		int eb=e;
		
		int t=c[e];
		while(i<e)
		{
			while(i<e&&c[i]>=t)i++;
			c[e]=c[i];
			while(i<e&&c[e]<=t)e--;
			c[i]=c[e];
		}
		
		if(i==d)
			return t;
		else
		{
			c[i]=t;
			if(i>d)
				return f(c,ib,i-1,d);
			else
				return f(c,e+1,eb,d);
		}
	}
}
